/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package usuario.frames;

import usuario.control.UserFrameDadosAddExcluir;
import usuario.control.UserFrameDadosAddRestaurar;
import bibliinfo.FrameMain;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JInternalFrame;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import utilitarios.Validar;

/**
 *
 * @author Ar0n
 */
public class UserFrameDadosAdicional extends javax.swing.JInternalFrame {

    /**
     * Creates new form UserFrameDadosAdicional
     */
    public UserFrameDadosAdicional() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktop = new javax.swing.JDesktopPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTLivros = new javax.swing.JTable();
        jLabel5 = new javax.swing.JLabel();
        jTDataCadAno = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jRBNao = new javax.swing.JRadioButton();
        jRBSim = new javax.swing.JRadioButton();
        jLDataInicio = new javax.swing.JLabel();
        jLDataFim = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel12 = new javax.swing.JLabel();
        jTDataCadMes = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jTDataCadDia = new javax.swing.JTextField();
        jTDataInicioDia = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jTDataInicioMes = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jTDataInicioAno = new javax.swing.JTextField();
        jTDataFimDia = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jTDataFimMes = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jTDataFimAno = new javax.swing.JTextField();
        jDesktopExcluir = new javax.swing.JDesktopPane();

        addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                formAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        jDesktop.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                jDesktopAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        jScrollPane1.setViewportView(jTLivros);

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5.setText("<html>Data de Cadastro:<b color=\"red\">*</b></html>");
        jLabel5.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataCadAno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataCadAnoKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataCadAnoKeyReleased(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("Outros Dados");
        jLabel6.setPreferredSize(new java.awt.Dimension(20, 15));

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel7.setText("Livros em Posse do Usuário");
        jLabel7.setPreferredSize(new java.awt.Dimension(20, 15));

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel8.setText("Suspenso:");
        jLabel8.setPreferredSize(new java.awt.Dimension(20, 15));

        jRBNao.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jRBNao.setText("Não");
        jRBNao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRBNaoActionPerformed(evt);
            }
        });

        jRBSim.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jRBSim.setText("Sim");
        jRBSim.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRBSimActionPerformed(evt);
            }
        });

        jLDataInicio.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLDataInicio.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLDataInicio.setText("Data Início Multa");
        jLDataInicio.setPreferredSize(new java.awt.Dimension(20, 15));

        jLDataFim.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLDataFim.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLDataFim.setText("Data Fim Multa");
        jLDataFim.setPreferredSize(new java.awt.Dimension(20, 15));

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel11.setText("Dados Empréstimo");
        jLabel11.setPreferredSize(new java.awt.Dimension(20, 15));

        jLabel12.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel12.setText("/");
        jLabel12.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataCadMes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataCadMesKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataCadMesKeyReleased(evt);
            }
        });

        jLabel13.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel13.setText("/");
        jLabel13.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataCadDia.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataCadDiaKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataCadDiaKeyReleased(evt);
            }
        });

        jTDataInicioDia.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataInicioDiaKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataInicioDiaKeyReleased(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel14.setText("/");
        jLabel14.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataInicioMes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataInicioMesKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataInicioMesKeyReleased(evt);
            }
        });

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel15.setText("/");
        jLabel15.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataInicioAno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataInicioAnoKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataInicioAnoKeyReleased(evt);
            }
        });

        jTDataFimDia.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataFimDiaKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataFimDiaKeyReleased(evt);
            }
        });

        jLabel16.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel16.setText("/");
        jLabel16.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataFimMes.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataFimMesKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataFimMesKeyReleased(evt);
            }
        });

        jLabel17.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel17.setText("/");
        jLabel17.setPreferredSize(new java.awt.Dimension(20, 15));

        jTDataFimAno.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTDataFimAnoKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTDataFimAnoKeyReleased(evt);
            }
        });

        jDesktopExcluir.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                jDesktopExcluirAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1)
            .addComponent(jSeparator2)
            .addComponent(jDesktop)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jScrollPane1)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLDataInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(2, 2, 2)
                                .addComponent(jTDataInicioDia, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTDataInicioMes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTDataInicioAno, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLDataFim, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTDataFimDia, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTDataFimMes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jTDataFimAno, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jRBNao)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jRBSim)))
                        .addGap(0, 102, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(594, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTDataCadDia, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTDataCadMes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTDataCadAno, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jDesktopExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(40, 40, 40))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(26, Short.MAX_VALUE)
                .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataCadAno, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataCadMes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataCadDia, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jDesktopExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jRBNao)
                    .addComponent(jRBSim))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTDataInicioAno, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataInicioMes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataInicioDia, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTDataFimAno, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataFimMes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jTDataFimDia, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLDataInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLDataFim, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jDesktop, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jDesktopAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jDesktopAncestorAdded
       if(componente == 1){
           escolheComp("edit");
       }else if(componente == 2){
           escolheComp("update");
       }        
    }//GEN-LAST:event_jDesktopAncestorAdded

    private void jRBNaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRBNaoActionPerformed
       alteraRadio(false); 
       habitaData(false);
    }//GEN-LAST:event_jRBNaoActionPerformed

    private void jRBSimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRBSimActionPerformed
        alteraRadio(true);        
        habitaData(true);
    }//GEN-LAST:event_jRBSimActionPerformed

    private void jDesktopExcluirAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jDesktopExcluirAncestorAdded
        DelOuRes();
    }//GEN-LAST:event_jDesktopExcluirAncestorAdded

    private void formAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_formAncestorAdded
        FrameMain.formata(13);
    }//GEN-LAST:event_formAncestorAdded

    private void jTDataCadDiaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataCadDiaKeyPressed
        Validar.validaNum(jTDataCadDia, 2);
    }//GEN-LAST:event_jTDataCadDiaKeyPressed

    private void jTDataCadDiaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataCadDiaKeyReleased
        Validar.validaNum(jTDataCadDia, 2);
    }//GEN-LAST:event_jTDataCadDiaKeyReleased

    private void jTDataCadMesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataCadMesKeyPressed
        Validar.validaNum(jTDataCadMes, 2);
    }//GEN-LAST:event_jTDataCadMesKeyPressed

    private void jTDataCadMesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataCadMesKeyReleased
        Validar.validaNum(jTDataCadMes, 2);
    }//GEN-LAST:event_jTDataCadMesKeyReleased

    private void jTDataCadAnoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataCadAnoKeyPressed
        Validar.validaNum(jTDataCadAno, 4);
    }//GEN-LAST:event_jTDataCadAnoKeyPressed

    private void jTDataCadAnoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataCadAnoKeyReleased
        Validar.validaNum(jTDataCadAno, 4);
    }//GEN-LAST:event_jTDataCadAnoKeyReleased

    private void jTDataInicioDiaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataInicioDiaKeyPressed
        Validar.validaNum(jTDataInicioDia, 2);
    }//GEN-LAST:event_jTDataInicioDiaKeyPressed

    private void jTDataInicioDiaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataInicioDiaKeyReleased
        Validar.validaNum(jTDataInicioDia, 2);
    }//GEN-LAST:event_jTDataInicioDiaKeyReleased

    private void jTDataInicioMesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataInicioMesKeyPressed
        Validar.validaNum(jTDataInicioMes, 2);
    }//GEN-LAST:event_jTDataInicioMesKeyPressed

    private void jTDataInicioMesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataInicioMesKeyReleased
        Validar.validaNum(jTDataInicioMes, 2);
    }//GEN-LAST:event_jTDataInicioMesKeyReleased

    private void jTDataInicioAnoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataInicioAnoKeyPressed
        Validar.validaNum(jTDataInicioAno, 4);
    }//GEN-LAST:event_jTDataInicioAnoKeyPressed

    private void jTDataInicioAnoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataInicioAnoKeyReleased
        Validar.validaNum(jTDataInicioAno, 4);
    }//GEN-LAST:event_jTDataInicioAnoKeyReleased

    private void jTDataFimDiaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataFimDiaKeyPressed
        Validar.validaNum(jTDataFimDia, 2);
    }//GEN-LAST:event_jTDataFimDiaKeyPressed

    private void jTDataFimDiaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataFimDiaKeyReleased
        Validar.validaNum(jTDataFimDia, 2);
    }//GEN-LAST:event_jTDataFimDiaKeyReleased

    private void jTDataFimMesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataFimMesKeyPressed
        Validar.validaNum(jTDataFimMes, 2);
    }//GEN-LAST:event_jTDataFimMesKeyPressed

    private void jTDataFimMesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataFimMesKeyReleased
        Validar.validaNum(jTDataFimMes, 2);
    }//GEN-LAST:event_jTDataFimMesKeyReleased

    private void jTDataFimAnoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataFimAnoKeyPressed
        Validar.validaNum(jTDataFimAno, 4);
    }//GEN-LAST:event_jTDataFimAnoKeyPressed

    private void jTDataFimAnoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTDataFimAnoKeyReleased
        Validar.validaNum(jTDataFimAno, 4);
    }//GEN-LAST:event_jTDataFimAnoKeyReleased

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JDesktopPane jDesktop;
    public javax.swing.JDesktopPane jDesktopExcluir;
    private javax.swing.JLabel jLDataFim;
    private javax.swing.JLabel jLDataInicio;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    public javax.swing.JRadioButton jRBNao;
    public javax.swing.JRadioButton jRBSim;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    public javax.swing.JTextField jTDataCadAno;
    public javax.swing.JTextField jTDataCadDia;
    public javax.swing.JTextField jTDataCadMes;
    public javax.swing.JTextField jTDataFimAno;
    public javax.swing.JTextField jTDataFimDia;
    public javax.swing.JTextField jTDataFimMes;
    public javax.swing.JTextField jTDataInicioAno;
    public javax.swing.JTextField jTDataInicioDia;
    public javax.swing.JTextField jTDataInicioMes;
    public javax.swing.JTable jTLivros;
    // End of variables declaration//GEN-END:variables
    //Atributos
    private static boolean estado;
    public static Map <String, JInternalFrame> mapa = new HashMap <String, JInternalFrame>();
    private int componente;    
    private boolean excluir;    
    public UserFrameDadosAddExcluir jBexcluir = new UserFrameDadosAddExcluir();                            
    public UserFrameDadosAddRestaurar jBrestaurar = new UserFrameDadosAddRestaurar();                        
    //métodos    
    public void setEstado(boolean estado){
        this.estado = estado;
    }
    public boolean getEstado(){
        return estado;
    }
    
    public void setComponente(int componente){
        this.componente = componente;
    }
    public int getComponente(){
        return this.componente;
    }
    
    public void setExcluir(boolean excluir){
        this.excluir = excluir;
    }
    public boolean getExcluir (){
        return excluir;
    }
    
    /**
     Método construido para alterar entre os RadioButoes presentes no frame
     */
    public void alteraRadio(boolean b){
        if(b == false){
            jRBNao.setSelected(true);
            jRBSim.setSelected(false);            
            jLDataInicio.setText("Data Início Multa:");
            jLDataFim.setText("Data Fim Multa:");            
            
            jTDataInicioDia.setText("");
            jTDataInicioMes.setText("");
            jTDataInicioAno.setText("");
            
            jTDataFimDia.setText("");
            jTDataFimMes.setText("");
            jTDataFimAno.setText("");
        }else if(b == true){
            jRBNao.setSelected(false);
            jRBSim.setSelected(true);            
            jLDataInicio.setText("<html>Data Início Multa:<b color=\"red\">*</b></html>");
            jLDataFim.setText("<html>Data Fim Multa:<b color=\"red\">*</b></html>");            
        }
    }
    /**
     método usado para formatar os internalFrames chamados dentro deste
     */    
    public void formata(int a){
        //retirando bordas do internalJframe
        ((BasicInternalFrameUI)mapa.get("frame"+a).getUI()).setNorthPane(null);
        mapa.get("frame"+a).setBorder(null);
        //pegando dimenções do JDesktop no qual ele esta encapsulado
        mapa.get("frame"+a).setBounds(0, 0, jDesktop.getWidth(), jDesktop.getHeight());
        mapa.get("frame"+a).setResizable(false); 
    }    
    /**
      método que me informara qual sera o internalFrame de complemento que eu usarei
     */
    public void escolheComp(String frame){
    
        if(frame.equalsIgnoreCase("save") == true){
            usuario.control.UserFrameDadosSave frameSalve = new usuario.control.UserFrameDadosSave();       
            jDesktop.add(frameSalve);
            frameSalve.show();
            mapa.put("frame1", frameSalve);
            formata(1);
        }else if (frame.equalsIgnoreCase("edit") == true){
            usuario.control.UserFameDadosAddEdit frameEdit = new usuario.control.UserFameDadosAddEdit();
            jDesktop.add(frameEdit);
            frameEdit.show();
            mapa.put("frame2", frameEdit);
            formata(2);
        }else if(frame.equalsIgnoreCase("update") == true){
            usuario.control.UserFrameDadosAddUpdate frameUpdate = new usuario.control.UserFrameDadosAddUpdate();
            jDesktop.add(frameUpdate);
            frameUpdate.show();
            mapa.put("frame3", frameUpdate);
            formata(3);
        }        
    }    
    /**
     Método que decidira qual será qual botão aparecera
     */    
    public void DelOuRes(){           
        
        if(this.excluir == true){                
            jBrestaurar.setVisible(false);
            jBexcluir.setVisible(true);                    
            //retirando bordas do internalJframe           
            ((BasicInternalFrameUI)jBexcluir.getUI()).setNorthPane(null);
            jBexcluir.setBorder(null);        
             //pegando dimenções do JFrame no qual ele esta encapsulado
            jBexcluir.setBounds(0, 0, jDesktopExcluir.getWidth(), jDesktopExcluir.getHeight());        
            jBexcluir.setResizable(false);
               
        }else if(this.excluir == false){                                           
            jBrestaurar.setVisible(true);
            jBrestaurar.show();
            //retirando bordas do internalJframe           
            ((BasicInternalFrameUI)jBrestaurar.getUI()).setNorthPane(null);
            jBrestaurar.setBorder(null);        
            //pegando dimenções do JFrame no qual ele esta encapsulado
            jBrestaurar.setBounds(0, 0, jDesktopExcluir.getWidth(), jDesktopExcluir.getHeight());        
            jBrestaurar.setResizable(false);                      
        }              
    }
    
    public void habitaData(boolean b){
        if(b == false){
            FrameMain.userFrameAdd.jTDataInicioDia.setEditable(false);
            FrameMain.userFrameAdd.jTDataInicioMes.setEditable(false);
            FrameMain.userFrameAdd.jTDataInicioAno.setEditable(false);
            
            FrameMain.userFrameAdd.jTDataFimDia.setEditable(false);
            FrameMain.userFrameAdd.jTDataFimMes.setEditable(false);
            FrameMain.userFrameAdd.jTDataFimAno.setEditable(false);

        }else{
            FrameMain.userFrameAdd.jTDataInicioDia.setEditable(true);
            FrameMain.userFrameAdd.jTDataInicioMes.setEditable(true);
            FrameMain.userFrameAdd.jTDataInicioAno.setEditable(true);  
            
            FrameMain.userFrameAdd.jTDataFimDia.setEditable(true);
            FrameMain.userFrameAdd.jTDataFimMes.setEditable(true);
            FrameMain.userFrameAdd.jTDataFimAno.setEditable(true);           
        }
    }
    
    public void chamarAdd(){
        jDesktopAncestorAdded(null);
    }
}
